import collections


class Solution(object):
    def isPossibleDivide(self, nums, k):
        c = collections.Counter(nums)
        v_list = list(c.keys())
        v_list.sort()
        for key in v_list:
            if c[key]:
                base_num = c[key]
                for num in range(key, key + k):
                    c[num] -= base_num
                    if c[num] < 0:
                        return False
        return True

data = Solution()
nums = [1,2,3,3,4,4,5,6]
k = 4
print(data.isPossibleDivide(nums, k))